Skip to content

fix(service-knowledge): a build that loses its lease stops at the next page, and a stalled build is cancelled - #37570

Draft
objectstack-fleet[bot] wants to merge 9 commits into
mainfrom
claude/issue-37465-build-lease-fence
Draft

objectstack-fleet[bot] wants to merge 9 commits into
mainfrom
claude/issue-37465-build-lease-fence

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #37465

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:多节点部署里,知识源重建时构建锁中途失效,构建会在下一页停下,状态显示为"租约丢失";嵌入调用卡住 15 分钟无进展,构建会被取消并释放锁,状态显示为"超时",不必重启即可再次重建。
  • 为什么做:属于知识检索(RAG)落地这条线,替运维省掉两个节点重复花的嵌入费用,也解决卡死后只能重启的问题。
  • 出错会怎样:最坏情况是一次正常但很慢的构建被误判停下,已写入的内容保留,下次重建会跳过已写部分;改动可直接撤回。
  • 要你做什么:无。

What changes

Cluster lease fence (service-knowledge). rebuildSource now runs its walk under a build fence (startBuildFence, knowledge-build.ts), and walkObjectSource asks the fence before each page:

  • The lease is lost when the handle reports isHeld() === false, when a renewal failed and the handle no longer holds the lease, or when no renewal has succeeded within BUILD_LEASE_MS. The last case covers a lock store that does not answer, or a renewal that hangs.
  • When the lease is lost, the walk stops before the next page's read: nothing more is embedded, purged or completed. The record's status is lease-lost and the lease is released.
  • A lease lost after the last page also skips the purge and completeBuild.

Stall bound (service-knowledge). BUILD_STALL_LIMIT_MS is a fixed 15-minute ceiling on the time between two pages (and before the first, and after the last). It is not a settings key and not an option, so ADR-0049's key-with-reader rule has no key to apply to.

  • Past the bound, the build is cancelled: its status is timed-out, the lease is released, and nothing is purged or completed.
  • The walk races its page-loop calls (engine.find, adapter.upsert, adapter.delete, beginBuild) against the bound, so a hung embed call no longer holds the source's walk chain, and the next rebuild runs at once.
  • rebuildSource also races the whole walk, which covers a hang in the listing, the purge or completeBuild.

pgvector builder-lock fence.

  • Each build write and removal (ctx.reason === 'reindex', for a build this adapter began) first checks in pg_locks, on the lock's own session, that the source's advisory lock is still held. If it is not, the write is refused with LOCK_CONFLICT (409) before anything is embedded.
  • completeBuild completes only the build this adapter began, and only the generation that build began. Otherwise it is refused with LOCK_CONFLICT and switches, records and deletes nothing.
  • A lock kept from an earlier build is re-checked at beginBuild, so a lock whose session ended is no longer kept.

N3. A pgvector search that meets three generation switches is refused with CONCURRENT_MODIFICATION (409). The rows for CONCURRENT_MODIFICATION and LOCK_CONFLICT leave scripts/error-status-unpinned-baseline.json. check:error-status-conformance required the LOCK_CONFLICT removal too, because the new pgvector refusals declare its status.

N2. Measured live: beginBuild under the active fingerprint already retires a building generation of another fingerprint. This PR pins that with a live test and states it in the docs; no code change was needed. What remains is that no build is due after a revert (readIndexState reads current), so the stale generation stays until the next build of any kind. See Acceptance notes.

N4 is not implemented. Two sweeps of one retired generation need two lock holders at once. The fence now refuses a lapsed builder's completeBuild, and beginBuild sweeps only under a freshly checked lock.

knowledge-turso (measured, not changed). It has no builder lock: beginBuild takes up any generation under the same fingerprint, so there is no builder identity for an "own generation" check beyond the fingerprint, which completeBuild already requires. Its cluster-lease protection is the service-level fence in this PR.

Docs. content/docs/ai/knowledge-rag.mdx adds generation item 6 (the pgvector fence), extends item 5 (the reverted fingerprint) and adds a paragraph on the two stops in "The first build, and rebuilding a source". None of these sections is one that #37442 edits.

Widening. The exported KnowledgeBuildRecord.status gains lease-lost and timed-out. Nothing else becomes newly exported from the package entry.

Files to read first (by risk)

  1. packages/services/service-knowledge/src/knowledge-service.ts, rebuildSource: the race on fence.cancelled, and the status taken from fence.stop() when the walk returns ok: false.
  2. packages/plugins/knowledge-pgvector/src/pgvector-adapter.ts: holdsBuilderLock (the pg_locks key split into classid/objid) and the completeBuild own-generation check.
  3. packages/services/service-knowledge/src/knowledge-build.ts, startBuildFence: the local lease expiry (heldUntil) for a renewal that never settles.

Two-minute verification

pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-build-fence.test.ts should report 8 passed. The first case shows 1 page embedded of 3 and lease-lost. The stall case shows timed-out at 15 minutes of fake time, then a next build that completes.

Tests

Local readings
  • knowledge-build-fence.test.ts (new, 8 cases):
    • lapse mid-walk: 1 of 3 pages embedded, find called once, completeBuild 0, lease-lost, released once;
    • lapse after the last page: no purge and no complete;
    • renewals that hang past the lease: lease-lost;
    • an embed call that never answers: timed-out at the bound, lease released, the next build done;
    • a slow build with progress inside each bound: done;
    • a hung completeBuild: timed-out;
    • no cluster service: bound only;
    • fence unit.
  • service-knowledge full suite: Test Files 15 passed, Tests 456 passed; typecheck exit 0.
  • knowledge-pgvector against a local PostgreSQL 16.16 with pgvector 0.8.7 (OS_EXPECT_LIVE_DIALECT_MATRIX=1): Test Files 8 passed, Tests 83 passed, against 76 before this PR. New: build-fence.live-postgres.test.ts (6 cases) and search-switches.test.ts (1). Typecheck exit 0.
  • Ablations, each a mutation on disk then git restore:
    • per-page lease check disabled: 2 fence cases red;
    • pgvector fenceBuild disabled: 2 live cases red;
    • rebuildSource race disabled: the hung-completeBuild case red.

Acceptance notes

  • The bound is per page, not per build. A whole-build ceiling would cut a large, healthy build. A page holds at most 100 rows, so 15 minutes without one finishing means a call is not answering. The value matches pgvector's default buildLockIdleMs.
  • A call the build stopped waiting on cannot be withdrawn. AdapterContext has no abort signal, and adding one would be an ADR-0161 contract member, which this PR does not add. If such a call answers later, its page is written; for pgvector that write is still fenced by the builder lock.
  • N2 remainder: after a revert, readIndexState reads current, so no build runs and the stale building generation stays until the next build. Retiring it without a build would need indexStatus or a read-time sweep. Not done here.
  • Turso N3 sibling: knowledge-turso's search still throws an uncoded error after three switches. It is outside this claim.
  • knowledge-service.ts edits stay inside walkObjectSource and rebuildSource, plus the import block and a one-parameter pass-through in reindexWith that threads the fence. None of these touches the regions feat(core): requires knowledge mounts the knowledge service and one vector store #37442 edits; overlap-check reports a clean merge.

Verification

  • overlap-check: VERDICT clean exit 0 against origin/main and feat(core): requires knowledge mounts the knowledge service and one vector store #37442.
  • The derived gates (109) ran locally with --repo objectstack-ai/objectstack:
    • 105 exited 0.
    • 3 were PREREQUISITE NOT MET (exit 3), so NOT MEASURED: check-plugin-teardown-shape --self-test (shallow clone), spec check:skill-examples (client-react not built) and check:dual-build-cjs-loads (needs a full build).
    • 1 was red and is fixed: check:objectql-double-limit flagged the new live test's engine double as unjudged. The double now filters and bounds like a find, and the re-run exits 0.

Generated by Claude Code

…ease is lost, and is cancelled when it stalls

Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ
Co-authored-by: Claude <noreply@anthropic.com>
…d completes nothing; an exhausted search is CONCURRENT_MODIFICATION

Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ
Co-authored-by: Claude <noreply@anthropic.com>
…or fence; changeset

Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ
Co-authored-by: Claude <noreply@anthropic.com>
…bounds like a find

Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/knowledge-pgvector, @objectstack/service-knowledge, touching 25 documentable anchor(s).

4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/knowledge-rag.mdx (via KnowledgeService (symbol, a top-level class), os knowledge rebuild (command, read off packages/cli/src/commands/knowledge/rebuild.ts))
  • content/docs/api/error-catalog.mdx (via CONCURRENT_MODIFICATION (symbol, a top-level const object), CONCURRENT_MODIFICATION (literal, a string literal in CONCURRENT_MODIFICATION))
  • content/docs/deployment/cli.mdx (via os knowledge rebuild (command, read off packages/cli/src/commands/knowledge/rebuild.ts))
  • content/docs/protocol/knowledge.mdx (via KnowledgeService (symbol, a top-level class), beginBuild (symbol, a method of class PgvectorKnowledgeAdapter), completeBuild (symbol, a method of class KnowledgeService; a method of class PgvectorKnowledgeAdapter))
What this run could not see
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 43 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a718701b273db47dc444a7783be98108e3e86ac9 — the merge of head fda121f9a6edf2713f0a03d3a622b0819ee6fd05 into base 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a718701b273db47dc444a7783be98108e3e86ac9 && git checkout a718701b273db47dc444a7783be98108e3e86ac9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 fda121f9a6edf2713f0a03d3a622b0819ee6fd05 && git checkout -B drift-repro 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 && git merge --no-ff fda121f9a6edf2713f0a03d3a622b0819ee6fd05

node scripts/docs-audit/affected-docs.mjs --json 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0f6a1e518f3c4639b03f86a8c07d9d08d91bddb6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 50bac35 · 2026-11-26T14:29Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 50bac3562b1062b21d1054699579007a03ac54f8
Local-runs: none

Inputs: card #37465 (body, triage, three scope notes, claim and its amend, both os-dev-reports), PR #37570 (body, 9 files), the net diff against main at the head, and the head's check-runs: 0 failure; every required context green (Lint & Repo Gates, TypeScript Type Check, Test Core 10/10, Build Core, Governed Surface Queue Guard, Test UI, Live E2E UI, Dogfood Regression Gate, Check Changeset). Temporal Conformance (live PG + MySQL) is skipped on the PR. So the six live build-fence.live-postgres cases, which carry the pg_locks reading, have the dev's local reading only (83/83 on PG 16.16) until the queue runs.

① Derived judgments

Accept-set and public-surface changes the diff implies:

  • KnowledgeBuildRecord.status gains lease-lost and timed-out. Right. The claim amend asked for it (Q2, option A), and the package entry exports no new name (index.ts still re-exports only BUILD_LEASE_MS, BUILD_PROGRESS_LOG_INTERVAL_MS and buildLockKey from knowledge-build.ts). startBuildFence, fencedCall and BUILD_STALL_LIMIT_MS stay internal. BUILD_STALL_LIMIT_MS is a fixed ceiling with no setting or option, so ADR-0049 has no key to apply to, as the card allowed.
  • pgvector write accept-set narrows for a build that lost its lock: an upsert or delete with ctx.reason === 'reindex' for a build this adapter began is refused LOCK_CONFLICT (409) once pg_locks on the lock's own session no longer shows the advisory lock. Right. This is the card's scope note of 09:43Z. Event-sync writes (another reason) are not fenced.
  • pgvector completeBuild refuses LOCK_CONFLICT unless this adapter began the build, still holds the lock, and the generation under its fingerprint is the one it began. Right, the scope note of 09:57Z; the live test drives two builders.
  • pgvector search exhaustion: an uncoded Error becomes CONCURRENT_MODIFICATION (409). Right, the scope note of 11:19Z (N3).
  • scripts/error-status-unpinned-baseline.json loses CONCURRENT_MODIFICATION and LOCK_CONFLICT. Right. Both sit under "Conflict Errors (409)" in content/docs/api/error-catalog.mdx, and every new producer declares 409. The baseline is shrink-only and a row that becomes pinned must leave; the conformance gate is in the green Lint & Repo Gates.

Seat questions:

  1. The lease fence in walkObjectSource. It is checked before each page (top of the loop, before engine.find) and once after the last page, before the purge. It is not checked again between the purge and completeBuild. A renewal that hangs or a lock store that does not answer reads as lost once heldUntil passes, which is startedAt + BUILD_LEASE_MS of the last renewal that succeeded. Further embedding spend stops at the next page boundary. The page in flight (at most 100 rows) still finishes; the card's "stops at the next page" allows this. Two paths still complete after the lease is gone: a lease lost during the purge, and a purge hung past the stall bound that answers later. See S1.
  2. The stall bound. For a hung embed call (upsert), and for find, delete and beginBuild, yes. fencedCall rejects at the bound, the walk returns, the reindexTails chain is freed, rebuildSource records timed-out and releases the lease, and the next rebuild completes (the test pins this). The progress callback is guarded on record.status !== 'running'. A late answer from a page call writes that page only (documented, ADR-0161 gives no abort signal); the walk then stops at its next fence.stop(), which keeps timed-out. The listing, the purge and completeBuild are not raced inside the walk. A hang there leaves the source's walk chain held after the record says timed-out, so the next rebuild on that node queues behind it and times out again (S2). A purge that answers late goes on to completeBuild (S1).
  3. pgvector. The pg_locks query runs on held.client, the session that took the lock. The key is split into classid/objid with objsubid = 1, which is how a one-bigint advisory lock shows. A query error reads as lost, which fails safe. completeBuild checks the lock and mine before the switch transaction, and the generation check inside it. One race remains: the lock can be lost between holdsBuilderLock and the commit, and a builder that took up the source resumes the same generation id, so the own-generation check cannot tell the two apart (N2). The outcome is benign: same fingerprint, and the first build's walk was complete. A live lock is read as lost behind a transaction-mode pooler. That setup was already documented as unsupported, but before this change its builds ran with a warning. Now every complete build is refused at its first page (S3).
  4. Error codes. Right. LOCK_CONFLICT 409 and CONCURRENT_MODIFICATION 409 match the catalog, both producers declare the status, and both baseline rows had to leave.

② Semver level

  • Changeset: @objectstack/service-knowledge patch and @objectstack/knowledge-pgvector patch. Both packages publish what the diff changes. The PR body and the changeset body each carry Clause-②: yes (widening) and Metadata-protocol: none. Right. Under AGENTS.md "Land it" item 3, a non-protocol widening ships at patch. No authorable key, value or metadata type changes, so none is right. Two values added to an exported output union is the widening arm the claim amend declared.
  • Seat Q5, consumers of the two new states:
    • os knowledge rebuild (packages/cli/src/commands/knowledge/rebuild.ts) continues only on running, succeeds only on done, and exits 1 with the record's message on anything else. Both new states are therefore read as failure, never as success.
    • describeBuild (packages/cli/src/utils/knowledge-actions.ts) prints the status verbatim. Its running checks are right for both.
    • The rebuild action's running guard (knowledge-build-actions.ts) lets a new rebuild start after either state.
    • content/docs/ai/knowledge-rag.mdx states both behaviours.
    • No ui/ consumer exists.
    • The only miss is cosmetic: the CLI's mirror type KnowledgeBuildView.status and the two not-run/failed comments in rebuild.ts still list four states (N1).

③ Boundary flags

  • Dev flags and open_questions: the blocked report's two questions were both answered by the claim amend (Q1 option A, Q2 option A). The final report has open_questions: []. Its deviations: the reindexWith pass-through and import block are within the amend's intent, overlap-check was clean, and the LOCK_CONFLICT baseline row is right per ①. The trailer form is not this record's concern.
  • N2 remainder: the stale building generation after a revert stays until the next build. It is named in the PR's acceptance notes and not filed. It needs no card now, because the rows are never read and the next build of any kind retires them. N4 is not implemented: the card marks it optional, and the fence removes its precondition.
  • Seat Q6, the turso sibling: the note's premise is wrong. At this head, and on main, knowledge-turso throws notReady(...), which is coded SERVICE_UNAVAILABLE 503 ("The knowledge store (libSQL) is not ready: its source's index was switched while it searched"). The error is coded, but under the wrong code: the same condition is 409 CONCURRENT_MODIFICATION on pgvector and a 503 "store not ready" on turso, and the two carry different retry semantics. Card-worthy: a small p3 parity card for the zone. Fix: code it CONCURRENT_MODIFICATION 409 like pgvector. It is not a blocker here (N4).
  • SQL push-down (AGENTS.md, Prime Directive 5): no new id materialisation and no in-app join. The lock check is one EXISTS over pg_locks. The own-generation check compares the at most two generation rows the existing locked read returns. Pass.

Findings:

  • S1 (should-fix) — walkObjectSource checks the fence once before the purge and never between the purge and completeBuild. A lease lost during a long purge is not seen. A purge hung past BUILD_STALL_LIMIT_MS that answers later goes on to complete the build after the lease was released, under a record that reads timed-out. Both contradict the new docs and jsdoc, which say neither stop purges or completes anything. pgvector's lock check still guards its switch, and the index stays correct, so this is a status and docs defect, not data loss. Fix: check fence?.stop() at the top of the private completeBuild helper, and add a test that loses the lease during the purge.
  • S2 (should-fix) — listAdapterDocuments, purgeDocuments and completeBuild are not wrapped in fencedCall. A hang in any of them keeps the source's reindexTails chain held after rebuildSource has returned timed-out, so a new rebuild on that node waits behind the chain and times out again until a restart. That contradicts "a new rebuild can start without a restart" for "a store call that never answers". The hung-completeBuild test stops at the first record. Fix: race those three calls as the page-loop calls are, or narrow the docs to page calls.
  • S3 (should-fix) — Behind a transaction-mode pooler, holdsBuilderLock reads a held lock as lost, so every complete pgvector build is now refused LOCK_CONFLICT at its first page. Before, it ran with a release warning. The builderLost remedy blames idle time or a dropped session. Fix: name the pooler cause in the remedy (as releaseBuilderLock's warning does), and say in the changeset that such a deployment now fails its builds.
  • N1 (nit) — packages/cli/src/utils/knowledge-actions.ts KnowledgeBuildView.status and the comments at rebuild.ts lines 23-24 and 67 still list four states. Runtime handling is right.
  • N2 (nit) — pgvector completeBuild's lock check runs before, and outside, the switch transaction. A lock lost in that window still switches, and a resumed builder shares the generation id, so the generation check cannot catch it. The outcome is benign; running the switch on the lock's own session would close the window.
  • N3 (nit) — pgvector's builds entry outlives an abandoned build. Once that build's lock idles out, the first later reason: 'reindex' write, even a non-build limit reindex, is refused once with a "this build no longer holds the lock" message.
  • N4 (nit) — The PR's acceptance note and the os-dev-report call turso's three-switch refusal "uncoded". It is SERVICE_UNAVAILABLE 503. Correct the note; the parity card in seat Q6 above carries the fix.
  • N5 (nit) — knowledge-rag.mdx: "another node may build the source from then on" after lease-lost. On pgvector the stopped build's advisory lock stays on this node until buildLockIdleMs, so another node's build is refused LOCK_CONFLICT meanwhile. Item 5 already says so; a cross-reference would keep the two from reading as contradictory.

No must-fix: the card's acceptance holds. The per-page lease check has its lapsed-mid-walk test, the bound has its never-answering-embed test with the lease released and the next build done, pgvector's own-generation completion is coded and tested with two builders, and the docs state both stops. Every check-run is green.

Implemented-by: claude/issue-37465-build-lease-fence
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: 50bac3562b1062b21d1054699579007a03ac54f8
REWORK — L1, seat repo:objectstack#5

  1. Shape: draft against main. service-knowledge, knowledge-pgvector, docs, the error-status baseline. 9 files, +984/−37. Not governed, not security-touching. Clause-②: yes (widening) at patch is right (record ②).
  2. Premise: the lease fence, the 15-minute stall bound and the pgvector pg_locks check are sound, and the two 409 codes and the baseline removals are right.
  3. Gates: contract record 7195078617 (TIER_DEFAULT) reads PASS, with three should-fix findings owed before landing. CI on this head: 0 failed. Temporal Conformance (live PG + MySQL) skips on the PR, so the six live fence tests run only in the merge queue; the dev's local 83/83 stands until then.
  4. Owed before landing (ids from the record):
    • S1: check fence?.stop() again in the private completeBuild helper, so a lease lost during the purge, or a purge that answers after the stall bound, completes nothing. Add a test that loses the lease during the purge.
    • S2: wrap the document listing, purgeDocuments and completeBuild in fencedCall, so a hung store call frees the reindexTails chain. Extend the hung-completeBuild test to start a second build and reach done.
    • S3: behind a transaction-mode pooler holdsBuilderLock reads a held lock as lost. Name the pooler in the builderLost remedy text and in the changeset.
  5. Ride along in the same delta if cheap (not blocking): N1 (the CLI's KnowledgeBuildView.status type and two rebuild.ts comments gain the two new states), N4 (correct the PR notes: turso's three-switch error is coded SERVICE_UNAVAILABLE 503, not uncoded), N5 (cross-reference docs item 5 from the lease-lost sentence). N2 and N3 are accepted. The turso 503 vs pgvector 409 parity is a p3 card the area files under service-knowledge: a build that loses its lease stops at the next page, and a build has a time bound #37465.
  6. Landing terms: after the delta the same reviewer re-checks it. Then the area lands it.

…ng, and a hung listing, purge or completion frees the source's walk

Also: the pgvector lost-lock remedy names the transaction-mode pooler; the CLI's build view knows lease-lost and timed-out; the docs cross-reference the builder lock's idle time.

Claude-Session: https://claude.ai/code/session_01Utp6Cb4BAjgQ43tqy1DvVJ
Co-authored-by: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

service-knowledge: a build that loses its lease stops at the next page, and a build has a time bound

2 participants